<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateProductCatesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('product_cates', function (Blueprint $table) {
            $table->id()->comment('商品分类辅助表');
            $table->integer('product_id')->index()->comment('商品id');
            $table->integer('category_id')->index()->comment('分类id');
            $table->integer('top_category_id')->index()->comment('顶级分类id');
            $table->integer('status')->default(1)->index()->comment('商品分类状态 0 = 禁用 1 = 启用');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('product_cates');
    }
}
